<?php

class DB {

	public function connect() {
		
		try {
			$dsn = "mysql:host=" . DBHOST . ";dbname=" . DBNAME . "";
			$connection = new PDO($dsn, DBUSER, DBPWD, array(PDO::ATTR_PERSISTENT => true, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
			$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
			return $connection;
		}
		catch (PDOException $e) {
			print "Connection failed: " . $e->getMessage() . "<br/>";
			die();
		}
		
	}
	
}

?>